package com.example.administrator.k3xiangmu.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.example.administrator.k3xiangmu.R;
import com.example.administrator.k3xiangmu.entity.SaomiaoEntity;
import com.example.administrator.k3xiangmu.entity.ShengchangrenwudanEntity;

import java.util.List;

/**
 * Created by Administrator on 2017-02-04.
 */
public class SaomiaoAdapter extends BaseAdapter {
    private List<SaomiaoEntity> list;
    private Context context;

    @Override
    public int getCount() {
        return list.size();
    }

    public SaomiaoAdapter(List<SaomiaoEntity> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder holder;
        if(convertView==null){
            convertView=View.inflate(context, R.layout.item_saomiao,null);
            holder=new Holder();

            holder.tv=(TextView) convertView.findViewById(R.id.no);
            convertView.setTag(holder);
        }else {
            holder=(Holder) convertView.getTag();
        }
        holder.tv.setText(list.get(position).getFBillNO());
        return convertView;
    }
    class Holder{
        private TextView tv;

    }
}
